home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc Development Framework / ODFDev / ODF / OS / FWWindow / Sources / FWFloWin.cpp next >
Encoding:
Text File  |  1995-11-08  |  3.1 KB  |  138 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWFloWin.cpp
  4. //    Release Version:    $ 1.0d11 $
  5. //
  6. //    Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifdef FW_PRECOMPILE_BY_LAYER
  11. #include "FWOS.hpp"
  12. #endif
  13.  
  14. #ifdef FW_PRECOMPILE_BY_SUBSYSTEM
  15. #include "FWWindow.hpp"
  16. #endif
  17.  
  18.  
  19. #ifndef FWFLOWIN_H
  20. #include "FWFloWin.h"
  21. #endif
  22.  
  23. #ifndef FWACQUIR_H
  24. #include "FWAcquir.h"
  25. #endif
  26.  
  27. // ----- Foundation Includes -----
  28.  
  29. #ifndef FWEXCLIB_H
  30. #include "FWExcLib.h"
  31. #endif
  32.  
  33. #ifndef   FWRESACC_H
  34. #include "FWResAcc.h"
  35. #endif
  36.  
  37. // ----- OpenDoc Includes -----
  38.  
  39. #ifndef SOM_ODWindow_xh
  40. #include <Window.xh>
  41. #endif
  42.  
  43. #ifndef SOM_ODStorageUnit_xh
  44. #include <StorageU.xh>
  45. #endif
  46.  
  47. #ifndef SOM_ODSession_xh
  48. #include <ODSessn.xh>
  49. #endif
  50.  
  51. #ifndef SOM_ODInfo_xh
  52. #include <Info.xh>
  53. #endif
  54.  
  55. #ifndef SOM_ODPart_xh
  56. #include <Part.xh>
  57. #endif
  58.  
  59. //========================================================================================
  60. //    Runtime Info
  61. //========================================================================================
  62.  
  63. #if FW_LIB_EXPORT_PRAGMAS
  64. #pragma lib_export on
  65. #endif
  66.  
  67. #ifdef FW_BUILD_MAC
  68. #pragma segment fwwindow
  69. #endif
  70.  
  71.  
  72. FW_DEFINE_CLASS_M1(FW_CFloatingWindow, FW_CWindow)
  73.  
  74. //========================================================================================
  75. // CLASS FW_CFloatingWindow
  76. //========================================================================================
  77.  
  78. //----------------------------------------------------------------------------------------
  79. // FW_CFloatingWindow::FW_CFloatingWindow
  80. //----------------------------------------------------------------------------------------
  81.  
  82. FW_CFloatingWindow::FW_CFloatingWindow(Environment* ev, 
  83.                                         ODPart* odPart,
  84.                                         ODTypeToken presentation,
  85.                                         const FW_CString& windowTitle,
  86.                                         const FW_CPoint& interiorSize,
  87.                                         const FW_CPoint& position,
  88.                                         FW_Boolean hasCloseBox) :
  89.     FW_CWindow(ev, 
  90.                 odPart, 
  91.                 NULL, 
  92.                 FALSE, 
  93.                 odPart->GetStorageUnit(ev)->GetSession(ev)->Tokenize(ev, kODViewAsFrame),
  94.                 presentation, 
  95.                 windowTitle,
  96.                 interiorSize, 
  97.                 position, 
  98.                 FW_kFloatingWindow | (hasCloseBox ? FW_kHasCloseBox : 0)),
  99.     fWasShown(FALSE)
  100. {
  101. }
  102.  
  103. //----------------------------------------------------------------------------------------
  104. // FW_CFloatingWindow::~FW_CFloatingWindow
  105. //----------------------------------------------------------------------------------------
  106.  
  107. FW_CFloatingWindow::~FW_CFloatingWindow()
  108. {
  109. }
  110.  
  111. //----------------------------------------------------------------------------------------
  112. // FW_CFloatingWindow::HideShowOnActivate
  113. //----------------------------------------------------------------------------------------
  114.  
  115. void FW_CFloatingWindow::HideShowOnActivate(Environment* ev, FW_Boolean state)
  116. {
  117.     if (GetID(ev) == kODNULLID)
  118.         return;
  119.     
  120.     FW_CAcquiredODWindow aqODWindow = AcquireODWindow(ev);    
  121.     if (state)
  122.     {
  123.         if (fWasShown)
  124.             aqODWindow->Show(ev);
  125.         fWasShown = FALSE;
  126.         aqODWindow->Update(ev);
  127.     }
  128.     else
  129.     {
  130.         if (IsShown(ev))
  131.         {
  132.             aqODWindow->Hide(ev);
  133.             fWasShown = TRUE;
  134.         }
  135.     }
  136. }
  137.  
  138.